﻿using AbpApplication.AppServices;
using Hangfire;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace UserInterface.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class HangFireController : ControllerBase
    {



        [HttpPost]
        public bool ClosePolling()
        {

            RecurringJob.RemoveIfExists("PollingTask");//移除轮询
            return true;
  
         
        }
        [HttpPost]
        public bool OpenPolling()
        {


            RecurringJob.AddOrUpdate<IBaseService>("PollingTask", job => job.PollingTask(), "*/10 * * * * *");
            return true;
        }

    }
}
